from multiprocessing import Queue, Process
import time


my_queue = Queue(maxsize=100)


class Response:
    status_code = 200


def sim_request(index, my_queue):
    response = Response()
    time.sleep(0.2)
    print(f"index: {index}, current resonse: {response.status_code}")
    print(f"lock id: {id(my_queue)}")
    my_queue.put(response.status_code, timeout=1)


if __name__ == "__main__":
    p_array = []
    for index in range(110):
        p = Process(target=sim_request, args=(index, my_queue))
        p.start()
        p_array.append(p)

    [p.join() for p in p_array]
    print("done!")
    for i in range(100):
        print(my_queue.get())